﻿@using Models;
@model List<player>
@{
    ViewBag.Title = "评分墙";
    Layout = "~/Areas/Admin/Views/Shared/_Layout.cshtml";
}
<link href="~/Areas/Admin/HTML/css/screen.css?v=(@DateTime.Now.ToString("yyyyMMddHHmmssffff"))" rel="stylesheet" />
<div class="screen-content">
    <div class="screen-header">
        <h1>平均分展示</h1>
        <h2>爱惜捷妇科腔镜视频大赛</h2>
        <img class="qr-code" src="/Areas/Admin/HTML/screenimgs/QRcode.jpg?v=1" onclick="showImg(this)" />
    </div>
    <div class="score-content">
        <table class="score-table" cellspacing="0" cellpadding="0">
            <thead>
                <tr>
                    <td colspan="4">
                        <img src="~/Areas/Admin/HTML/screenimgs/gold.png" />平均分
                    </td>
                </tr>
            </thead>
            <tbody>
                @foreach (var item in Model)
                {
                    <tr>
                        <td class="avator"><img src="@(string.IsNullOrWhiteSpace(item.headimg)?"/Areas/Admin/HTML/screenimgs/avator.png":item.headimg)" /></td>
                        <td class="sort">@(item.sort)号选手</td>
                        <td class="name">@item.name</td>
                        <td class="score"><span id="player-@item.id">@(item.score)</span> 分</td>
                    </tr>
                }
            </tbody>
        </table>
    </div>
</div>
<script>
    setInterval(function () {
        $.get('/admin/screen/expertwall', null, function (data) {
            for (var i = 0; i < data.length; i++) {
                $('#player-' + data[i].id).text(data[i].score);
            }
        })
    }, 3000);
    function showImg(target) {
        var img = $(target).attr("src");
        layer.open({
            type: 1,
            offset: '20px',
            title: false,
            skin: 'layui-layer-demo', //样式类名
            closeBtn: 1, //不显示关闭按钮
            shadeClose: true, //开启遮罩关闭
            area: ['700px', '700px'],
            content: '<img src="' + img + '" width="100%"/>'
        });
    }
</script>